package cn.openea.perpartner.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.openea.perpartner.system.entity.SysConfig;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * @author Weird077
 * @description TODO
 * @date 2022-05-09 16:59
 */
@Repository
public interface SysConfigMapper extends BaseMapper<SysConfig> {


    /**
     * 查询参数配置信息
     *
     * @param config_key 参数配置信息
     * @return 参数配置信息
     */
    @Select("select * from sys_config where config_key = #{config_key}")
    SysConfig selectConfig(String config_key);

    /**
     * 根据键名查询参数配置信息
     *
     * @param configKey 参数键名
     * @return 参数配置信息
     */
    @Select("select * from sys_config where config_key = #{configKey} limit 1")
    SysConfig checkConfigKeyUnique(String configKey);


    /**
     * 删除参数配置
     *
     * @param configId 参数ID
     * @return 结果
     */
    @Select("delete  from sys_config where config_id = #{configId}")
    int deleteConfigById(Long configId);

}
